//
//  SYDetailsCRV.m
//  TermOfSectionB
//
//  Created by 韩震明 on 15/12/1.
//  Copyright © 2015年 韩震明. All rights reserved.
//

#import "SYDetailsCRV.h"
#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height

@implementation SYDetailsCRV

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.topView = [[UIView alloc] init];
        [self addSubview:self.topView];
        self.topView.backgroundColor = [UIColor whiteColor];
        
        self.topImageView = [[UIImageView alloc] init];
        [self.topView addSubview:self.topImageView];
        
        self.imageViewTitle = [[UILabel alloc] init];
        [self.topImageView addSubview:self.imageViewTitle];
        self.imageViewTitle.font = [UIFont systemFontOfSize:18.0];
        self.imageViewTitle.textColor = [UIColor whiteColor];
        
        self.desc = [[UILabel alloc] init];
        [self.topView addSubview:self.desc];
        self.desc.numberOfLines = 0;
        [self.desc sizeToFit];
        self.desc.textColor = [UIColor grayColor];
        self.desc.font = [UIFont systemFontOfSize:14.0];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.topView.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    self.topImageView.frame = CGRectMake(0, 0, WIDTH, HEIGHT / 2);
    self.imageViewTitle.frame = CGRectMake(self.topImageView.frame.size.width / 30, 8 * self.topImageView.frame.size.height / 10, 28 * self.topImageView.frame.size.width / 30, self.topImageView.frame.size.height / 6);
    self.desc.frame = CGRectMake(5, HEIGHT / 2, WIDTH - 10, HEIGHT / 2 - 30);
}

@end
